package com.sunxiansheng.designPattern.factoryandstragy;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Description: 业务层
 * @Author sun
 * @Create 2024/7/22 12:10
 * @Version 1.0
 */
@Service
public class ServiceHandler {

    /**
     * 依赖存放策略的策略工厂
     */
    @Resource
    private PayFactory payFactory;

    public void dealPay(int code) {
        PayHandler handlerByCode = payFactory.getHandlerByCode(code);
        handlerByCode.dealPay();
    }

}